package export.monster
{
	import base.BaseMonster;
	import com.game.data.constant.FrameRate;
	
	import com.game.manager.AnimationManager;
	
	import export.bullet.EnemyMoveBullet;
	
	import export.bullet.RegionBullet;
	
	import flash.geom.Rectangle;
	//鲇鱼精
	public class Monster303 extends BaseMonster
	{
		public function Monster303()
		{
			super();
		}
		
		override protected function initBBDC():void
		{
			bbdc = AnimationManager.getAnimation("Monster303Action");
			bbdc.setAction("idle");
			bbdc.turnRight();
			bbdc.addCallBack(onEnterFrame, onActionOver);
			bodyContainer.addChild(bbdc);
		}
		
		override protected function initCollideArea():void
		{
			collideBox = new Rectangle(-25,-82,50,82);
			super.initCollideArea();
		}
		
		override protected function initAttribute():void
		{
			super.initAttribute();
			mavo.attackRange = 150;
		}
		
		override protected function onEnterFrame(action:String, frameCount:int):void
		{
			switch (action)
			{
				case "attack1":
					if(frameCount == 1)
					{
						var b:RegionBullet = new RegionBullet();
						b.setOwner(this);
						b.setHurt(getActionHurt("attack1"));
						b.setDirect(bbdc.getDirect());
						b.setCollideArea(-10,-100,140 * bbdc.getDirect(),100);
						b.setAction("Monster303Attack1");
						b.setDestroyInCount(8);
						gc.gameScene.addChild(b);
						magicBulletArray.push(b);
					}
					if(frameCount == 13)
					{
						var b:RegionBullet = new RegionBullet();
						b.setOwner(this);
						b.setHurt(getActionHurt("attack1"));
						b.setDirect(bbdc.getDirect());
						b.setCollideArea(-10,-100,140 * bbdc.getDirect(),100);
						b.setAction("Monster303Attack1");
						b.hitVO.stiffTime = FrameRate.ANIMATE_FRAME_RATE;
						b.setDestroyInCount(8);
						gc.gameScene.addChild(b);
						magicBulletArray.push(b);
					}
					break;
				case "skill1":
					if(frameCount == 5)
					{
						var bu:EnemyMoveBullet = new EnemyMoveBullet("Monster303Bullet1");
						bu.setOwner(this);
						bu.setAction("Monster303Skill1")
						bu.setHurt(getActionHurt("skill1"));
						bu.setDirect(bbdc.getDirect());
						bu.setPosition(getCollideCenter().x,getCollideCenter().y);
						bu.setSpeed(10 * bbdc.getDirect(),0);
						bu.setSpeedAdd(3 * bbdc.getDirect(),0);
						bu.setDistance(1000);
						gc.gameScene.addChild(bu);
						magicBulletArray.push(bu);
					}
			}
		}
		override protected function beforeSkill1Start():Boolean
		{
			return hasTarget() && AUtils.GetDisBetweenTwoObj(curAttackTarget,this) < 550;
		}
	}
}
/*
package export.monster
{
	
	import base.BaseAddEffect;
	import base.BaseBitmapDataClip;
	import base.BaseBitmapDataPool;
	import base.BaseMonster;
	
	import com.dusk.util.ResUtil;
	
	import export.bullet.FollowTargetBullet;
	import export.bullet.SpecialEffectBullet;
	
	import flash.display.Sprite;
	
	import flash.geom.Point;
	
	public class Monster303 extends BaseMonster
	{
		private var _n:String = "鲶鱼精";
		
		public function Monster303()
		{
			super();
			this.horizonSpeed = 3;
			this.attackBackInfoDict["hit1"] = {
				"hitMaxCount"    : 99,
				"attackBackSpeed": [6, -5],
				"attackInterval" : 999,
				"power"          : 370,
				"attackKind"     : "physics"
			};
			this.attackBackInfoDict["hit2"] = {
				"hitMaxCount"    : 99,
				"attackBackSpeed": [6, -5],
				"attackInterval" : 999,
				"power"          : 370,
				"attackKind"     : "magic",
				"addEffect"      : [{
					"name": BaseAddEffect.STUN,
					"time": gc.frameClips * 1
				}]
			};
			this.setAction("idle");
		}
		
		override protected function initBBDC():void
		{
			var _loc1_:* = null;
			var _loc2_:Array = BaseBitmapDataPool.getBitmapDataArrayByName("Monster303");
			if (_loc2_)
			{
				_loc1_ = {
					"name"  : "body",
					"source": _loc2_
				};
				bbdc = new BaseBitmapDataClip([_loc1_], 200, 200, new Point(0, 0));
				bbdc.setOffsetXY(-13, 3);
				bbdc.setFrameStopCount([[2, 2, 2, 3, 2, 4], [4, 4, 4, 4], [15], [2, 2, 2, 2, 2, 10], [2, 2, 2, 2, 2, 10], [2, 2, 10]]);
				bbdc.setFrameCount([6, 4, 1, 6, 6, 3]);
				bbdc.setEnterFrameCallBack(this.enterFrameFunc, this.exitFrameFunc);
				bbdc.setAddScriptWhenFrameOver(this.scriptFrameOverFunc);
				this.bodyContainer.addChild(bbdc);
				return;
			}
			throw new Error("Monster303--BitmapData Error!");
		}
		
		override protected function initCollideArea():void
		{
			this.colipse = ResUtil.getNewObj("ObjectBaseSprite") as Sprite;
			this.colipse.visible = false;
			this.addChild(this.colipse);
		}
		
		override public function setAction(param1:String):void
		{
			super.setAction(param1);
			var _loc2_:Point = this.bbdc.getCurPoint();
			switch (param1)
			{
				case "idle":
					if (_loc2_.y != 0)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(0);
					}
					this.bbdc.setState(param1);
					break;
				case "walk":
					if (_loc2_.y != 1)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(1);
					}
					this.bbdc.setState(param1);
					break;
				case "hit1":
					if (_loc2_.y != 4)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(4);
					}
					this.bbdc.setState(param1);
					break;
				case "hit2":
					if (_loc2_.y != 5)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(5);
					}
					this.bbdc.setState(param1);
					break;
				case "hurt":
					if (_loc2_.y != 2)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(2);
					}
					this.bbdc.setState(param1);
					break;
				case "dead":
					if (_loc2_.y != 3)
					{
						this.bbdc.setFramePointX(0);
						this.bbdc.setFramePointY(3);
					}
					this.bbdc.setState(param1);
			}
		}
		
		override protected function scriptFrameOverFunc(param1:int):void
		{
			var _loc2_:String = this.bbdc.getState();
			switch (_loc2_)
			{
				case "walk":
					this.bbdc.setFramePointX(0);
					break;
				case "idle":
					this.bbdc.setFramePointX(0);
					break;
				case "hit1":
					this.setAction("idle");
					break;
				case "hit2":
					this.setAction("idle");
					break;
				case "hurt":
					this.setAction("idle");
					break;
				case "dead":
					this.dropAura();
					this.destroy();
			}
		}
		
		override protected function enterFrameFunc(param1:Point):void
		{
			var _loc2_:String = this.bbdc.getState();
			var _loc3_:uint = this.getBBDC().getDirect();
			switch (_loc2_)
			{
				case "hit1":
					if (param1.x == 2)
					{
						if (this.bbdc.getCurFrameCount() == 2)
						{
							this.doHi1(_loc3_);
							break;
						}
						break;
					}
					break;
				case "hit2":
					if (param1.x == 2)
					{
						if (this.bbdc.getCurFrameCount() == 10)
						{
							this.doHi2(_loc3_);
							break;
						}
						break;
					}
			}
		}
		
		override protected function beforeSkill1Start():Boolean
		{
			return this.hasTarget() && AUtils.GetDisBetweenTwoObj(this.curAttackTarget, this) < 200;
		}
		
		override protected function releSkill1():void
		{
			
			this.setInvincible(10);
			this.setAction("hit2");
			this.lastHit = "hit2";
		}
		
		override protected function exitFrameFunc(param1:Point):void
		{
		}
		
		override protected function myIntelligence():void
		{
			if (!this.isBeAttacking())
			{
				super.myIntelligence();
			}
		}
		
		private function doHi1(param1:uint):void
		{
			var _loc2_:FollowTargetBullet = new FollowTargetBullet("Monster303Bullet1");
			if (param1 == 0)
			{
				_loc2_.x = this.x - 160;
			}
			else
			{
				_loc2_.x = this.x + 160;
			}
			_loc2_.y = this.y - 60;
			_loc2_.setOwner(this);
			_loc2_.setDirect(param1);
			_loc2_.setAction("hit1");
			gc.gameScene.addChild(_loc2_);
			this.magicBulletArray.push(_loc2_);
		}
		
		private function doHi2(param1:uint):void
		{
			var _loc2_:SpecialEffectBullet = new SpecialEffectBullet("Monster303Bullet2");
			if (param1 == 0)
			{
				_loc2_.x = this.x - 100;
			}
			else
			{
				_loc2_.x = this.x + 100;
			}
			_loc2_.y = this.y - 60;
			_loc2_.setOwner(this);
			_loc2_.setDirect(param1);
			_loc2_.setAction("hit2");
			gc.gameScene.addChild(_loc2_);
			this.magicBulletArray.push(_loc2_);
		}
	}
}
*/
